package com.own.system.config.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//跨域配置
@Configuration
public class CORSConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")//允许跨域访问的url
                .allowedHeaders("*")//允许跨域访问的请求头
                .allowedOrigins("*")//允许跨域访问的域名
                .allowedHeaders("*");//允许跨域访问的headers方法
    }
}
